/*
 * EventManager.h
 *
 *  Created on: 2012-3-27
 *      Author: chenjialiang
 */

#pragma once
#include <event.h>

namespace Zha
{

class EventManager
{
public:
	enum
	{
		EVENT_READ = EV_READ,
		EVENT_WRITE = EV_WRITE,
	};
	typedef void (CallbackFunc_t)(int fd, short event, void *args);

	static EventManager& Instance();
public:
	virtual ~EventManager();

public:
	event* CreateReadEvent(int fd, CallbackFunc_t *cb, void* args);
	void AddEvent(event *ev);
	void Dispatch();

protected:
	EventManager();
};

} /* namespace Zha */

